<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible">
    <title>产品详情</title>
    <link rel="Shortcut Icon" href="{{asset('admin_assets/img/HB.ico') }}"/>
    <link rel="Bookmark" href="{{asset('admin_assets/img/HB.ico') }}" />
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta name="_token" content="{{ csrf_token() }}"/>
    <link rel="stylesheet" href="{{asset('admin_assets/css/bootstrap.min.css')}}">
    <link rel="stylesheet" type="text/css" href="{{asset('admin_assets/css/font-awesome/css/font-awesome.min.css')}}">
    <link rel="stylesheet" href="{{asset('admin_assets/css/AdminLTE.min.css')}}">
    <link rel="stylesheet" href="{{asset('admin_assets/css/skins/_all-skins.min.css')}}">
    <link rel="stylesheet" href="{{asset('admin_assets/css/jquery.magnify.min.css')}}">
    <link rel="stylesheet" href="{{asset('admin_assets/css/bootstrap-datetimepicker.min.css')}}">
    <style>
        .title {
            text-align: center;
            color: #676767;
        }
        .table-th {
            width: 25%;
            text-align: center;
            color: #676767;
        }
        .table-td {
            width: 25%;
            text-align: center;
            color: #676767;
        }
        .file-th{
            text-align: center;
            color: #676767;
        }
        .file-td{
            text-align: center;
            color: #676767;
        }
        .first{
            width: 10%;
        }
    </style>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper" style="background: white;">
    <div class="content-wrapper" style="background-color: white;width: 100%;margin-left: 0">
        <section class="content">
            <div class="row">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                    <div class="box box-info"
                         style="padding-top: 0px;margin-top: 0px;border-top: 0px;border-bottom: solid 1px #0080ff;">
                        <div class="box-body">
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12" style="margin-top: 0.5vw">
                                    <a href="#" title="返回首页"><i
                                                class="fa fa-home fa-2x"
                                                style="width: 100%;color: #0080FF">
                                            <span style="font-size: 1.2vw">&nbsp;产品详情</span></i></a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            @include('public/alert')
            <h3 class="title" style="margin-top: 1%">产品信息</h3>
            <div class="row">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <tbody>
                            <tr>
                                <th class="table-th first">类型</th>
                                <td class="table-td">{{$product['first_type']['name']}}</td>
                                <th class="table-th first" rowspan="3" style="text-align: center ;vertical-align:middle;" >名称</th>
                                <td class="table-td" rowspan="3" style="text-align: center ;vertical-align:middle;">
                                    @if(empty($product['name_pic']))
                                        @if(!empty($product['name']))
                                            {{$product['name']}}
                                            @else
                                            暂未设置
                                        @endif
                                    @else
                                        <img data-toggle="modal"
                                             class="upload_name_pic"
                                             title="{{$product['name']}}"
                                             alt="
                                             @if(!empty($product['name']))
                                             {{$product['name']}}
                                             @else
                                                     暂未设置
                                             @endif"
                                             data-target="#modal-uploads-pic"
                                             data-product_id="{{$product['id']}}"
                                             src="{{asset("Uploads/DescriptionNamePic/".$product['name_pic'])}}" width="120px" height="180px">
                                    @endif

                                </td>
                            </tr>
                            <tr>
                                <th class="table-th first">类别</th>
                                <td class="table-td">{{$product['second_type']==null?"暂无数据":$product['second_type']['name']}}</td>

                            </tr>
                            <tr>
                                <th class="table-th first">申请日期</th>
                                <td class="table-td">{{date("Y-m-d",strtotime($product['created_at']))}}</td>

                            </tr>

                            <tr>
                                <th class="table-th first">申请人</th>
                                <td class="table-td">{{$product['applicant']}}</td>
                                <th class="table-th first">联系电话</th>
                                <td class="table-td">{{$product['phone']}}</td>
                            </tr>

                            </tbody>
                        </table>
                    </div>
                    <div class="table-responsive">
                      @foreach($product['progress'] as $k => $val)
                            <table class="table table-bordered" style="margin-top: 1%">
                                <tbody>

                                       <tr>
                                           <td class="process-claim-td" colspan="4" >
                                               <h3 align="center">
                                                   @if((int)$val["is_renew"]==0)
                                                       首次任务
                                                   @else
                                                       续费任务
                                                   @endif
                                               </h3>
                                           </td>
                                       </tr>
                                <tr>
                                    <th class="table-th first">款项总额</th>
                                    <td class="table-td">
                                        @if(!empty($val['price']))
                                            ¥{{$val['price']}}
                                        @else
                                            暂未设置
                                        @endif

                                       </td>
                                    <th class="table-th first">当前进度</th>
                                    <td class="table-td">{{$product['progress_state']==null?"已认领":$product['progress_state'][0]['name']}}</td>
                                </tr>
                                <tr>
                                    <th class="table-th first">首付金额</th>
                                    <td class="table-td">
                                        @if(!empty($val['first_payment']))
                                            ¥{{$val['first_payment']}}
                                            @if(!empty($val['first_pay_time']))
                                                已结付
                                                @else
                                                未支付
                                            @endif
                                        @else
                                            暂未设置
                                        @endif

                                       </td>
                                    <th class="table-th first">报件资料</th>
                                    @if(!empty($product['file']))
                                        <a target="_blank" herf="{{asset('Uploads/resources/'.$product['file'])}}"><td class="table-td">点击审阅</td></a>
                                    @else
                                        <td class="table-td">未上传</td>
                                    @endif
                                </tr>
                                <tr>
                                    <th class="table-th first">尾款金额</th>
                                    <td class="table-td">
                                        @if(!empty($val['tail_payment']))
                                            ¥{{$val['tail_payment']}}
                                            @if(!empty($val['tail_pay_time']))
                                                已结付
                                            @else
                                                未支付
                                            @endif
                                        @else
                                            暂未设置
                                        @endif

                                    </td>
                                    <th class="table-th first">通知书</th>
                                        <td class="table-td">共{{count($product['files'])}}件</td>
                                </tr>
                                </tbody>
                            </table>
                        @endforeach
                    </div>
                </div>
            </div>
            <h3 class="title">上传文件列表</h3>
            <div class="row">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <tbody>
                            <tr>
                                <th class="file-th first">编号</th>
                                <td class="file-th">名称</td>
                                <th class="file-th">用户是否查看</th>
                                <th class="file-th">操作</th>
                            </tr>
                            @if(!empty($product['files']))
                                @foreach($product['files'] as $key =>$value)
                                    <tr>
                                        <td class="file-td">{{$key+1}}</td>
                                        <td class="file-td">{{$value['name']}}</td>
                                        <td class="file-td">
                                            @if($value['yn'] == 1)
                                                已看
                                                @else
                                            未看
                                                @endif
                                        </td>
                                        <td class="file-td">
                                            <a href="{{asset("Uploads/resources/".$value['url'])}}" data-magnify="gallery" data-caption="文件在线预览">在线预览</a>
                                            <a  href="{{route("management.process.doloadFile",["file_id"=>$value['id']])}}" class="download-file" data-file_id="{{$value['id']}}">审阅</a>
                                            <a href="#" class="delete-file" data-file-name="{{$value['name']}}" data-productId="{{$product['id']}}"  data-file-id="{{$value['id']}}">删除</a>
                                        </td>
                                    </tr>
                                @endforeach
                            @else
                                <tr><td class="process-claim-td" colspan="4" ><h3 align="center">暂无数据</h3></td></tr>
                            @endif
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <h3 class="title">操作记录</h3>
            <div class="row">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <tbody>
                            <tr>
                                <th class="file-th first">编号</th>
                                <td class="file-th">处理项</td>
                                <th class="file-th">处理人</th>
                                <th class="file-th">处理日期</th>
                            </tr>
                            @if(!empty($product['operation']))
                                @foreach($product['operation'] as $key =>$value)
                                    <tr>
                                        <td class="file-td">{{$key+1}}</td>
                                        <td class="file-td">{{$value['content']}}</td>
                                        <td class="file-td">{{$value['operator_name']}}</td>
                                        <td class="file-td">{{date("Y-m-d H:i",strtotime($value['created_at']))}}</td>
                                    </tr>
                                @endforeach
                                @else
                                <tr><td class="process-claim-td" colspan="4" ><h3 align="center">暂无数据</h3></td> </tr>
                            @endif
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </section>
    </div>
    <footer class="main-footer" style="background-color: #eaeaea;text-align: center; font-size: 0.8vw;;margin-left: 0">
        Copyright &copy; 2018 <a href="http://www.hongbung.com" target="_blank">上海宏邦知识产权代理有限公司</a>
    </footer>
</div>
<script type="text/javascript" src="{{asset('admin_assets/js/jquery.min.js')}}"></script>
<script type="text/javascript" src="{{asset('admin_assets/js/bootstrap.min.js')}}"></script>
<script type="text/javascript" src="{{asset('admin_assets/js/adminlte.min.js')}}"></script>
<script type="text/javascript" src="{{asset('admin_assets/js/bootstrap-datetimepicker.js')}}"></script>
<script type="text/javascript" src="{{asset('admin_assets/js/jquery.magnify.min.js')}}"></script>
<!--底部引入js-->
<script>
    $(".delete-file").click(function () {
        var id=$(this).attr("data-file-id");
        var productId=$(this).attr("data-productId");
        var file_name=$(this).attr("data-file-name");
        var url="{{route("management.process.deleteFile")}}";
        var formData = new FormData();
        formData.append("file_id" , id);
        formData.append("productId" , productId);
        formData.append("file_name" , file_name);
        $.ajax({
            url:url,
            data:{
                "file_id" :id ,
                "productId" : productId,
                "file_name" : file_name,
            },
            type:"post",
            headers: {
                'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
            },
            success:function (data) {
                $returnData=JSON.parse(data);
                alert($returnData.message);
                if($returnData.code==3){
                        self.location='{{route("management.process.login")}}';
                }else{
                    window.location.reload();
                }


            },
            error:function (data) {
                alert("删除失败");
                window.location.reload();
            }


        });
    });




</script>


</body>
</html>
